home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr18
/
mrun210.zip
/
MRUN210.WAS
< prev
next >
Wrap
Text File
|
1993-04-28
|
34KB
|
1,040 lines
;MailRun v2.10: Automated BBS Communications
;1992-1993 Gerald P. Sully, all rights reserved.
#comment
**************************************************************************
**************************************************************************
*
* The source code for MailRun is contained in 9 separate files:
* MRUN210.WAS (this file), MRUN210.H (a header file), and files
* named MRUN210?.WAS, where ? is a letter A through G. MailRun
* also requires the file MRUNICON.DLL in order to display the
* tool bar.
*
* MRUN210.WAS is the script from which the other script files
* are run. It performs a brief initialization to find the
* location of its support files, then chains to MRUN210A.WAS,
* which is the principle engine of MailRun. It will also
* perform an install routine if it finds that there is no
* current MAILRUN.INI file.
*
* The key files of MailRun are the *.MRN files. These
* store configuration information and control what tasks
* will be performed on each BBS. The user interface is
* designed to provide a convenient way to edit these files
* and display their contents. The files are standard INI
* files, and so may also be edited by hand. The comm engine,
* contained in MRUN210G.WAS, reads the currently loaded *.MRN
* file, calls each BBS and executes each pending task.
*
**************************************************************************
**************************************************************************
#endcomment
#define IniFile 0
string MailRunIni, MailRunList, MailRunTrunc, MailRun, OldIni
string MailRunDir, MailDir, ReplyDir, DownloadDir, UploadDir, TempDir
string DialAttempts, DialTimeout, DialPause, IdleTimeout, SavePackets
string Archiver, QWKReader, LogViewer
integer LogRun, AppendLog, AnsiInLog, NewfileFilter, HelpPage
float Version
#comment
*********************************************************************
*
* MAIN()
*
* Calls makefullname(), checkdir(), makeini(), gettempdir(),
* delspec(), changesettings(), movedir(), updatemrn()
*
* Executes MRUN210A.WAX
*
* Checks for existence of MAILRUN.INI file, then chains
* to the main body of the script.
*
*********************************************************************
#endcomment
proc main
string MRunMain, temp, MailRunHelp
MailRunHelp = makefullname($PWTASKPATH, "mailrun.hlp")
if isfile MailRunHelp
set aspect helpfile "mailrun.hlp"
endif
;Create the temporary directory
gettempdir()
if !(checkdir(TempDir, ""))
halt
endif
MailRunIni = makefullname($WINPATH, "MAILRUN.INI")
profilerd MailRunIni "MailRun" "Version" temp
atof temp Version
if Version != 2.10
;if there is no .INI file for version 2.10, run install procedure
fetch aspect scriptpath temp
temp = makefullname(temp, "mailrun.hlp")
if not strcmpi MailRunHelp temp
copyfile temp MailRunHelp
delfile temp
endif
set aspect helpfile "mailrun.hlp"
makeini()
changesettings()
movedir()
updatemrn()
delfile OldIni
statmsg "Installation complete!"
endif
;Make sure the Temp directory is empty
delspec(TempDir, "*.*")
profilerd MailRunIni "MailRun" "MailRunDir" MailRunDir
MRunMain = makefullname(MailRunDir, "MRUN210A")
execute MRunMain
endproc
#comment
*********************************************************************
*
* DELSPEC()
*
* Called by main()
*
* Calls makefullname()
*
* Deletes specified filespec from specified directory.
*
*********************************************************************
#endcomment
proc delspec
strparm dirname, spec
string filename, filespec
FileSpec = makefullname(dirname, spec)
findfirst FileSpec
while FOUND
FileName = makefullname(dirname, $FILENAME)
delfile FileName
findnext
endwhile
endproc
#comment
*********************************************************************
*
* MAKEINI()
*
* Called by main()
*
* Calls welcomebox(), getbbstypes()
*
* Creates the MAILRUN.INI file and sets default values.
*
*********************************************************************
#endcomment
proc makeini
string StateDLPath, StateULPath, AspectDir, temp, MailRunBak
integer dialogstatus
integer StateWaitCnct, StateCallPause, StateMaxDial
welcomebox()
;Check whether user wishes to continue
while 1
dialogstatus = $DIALOG
switch dialogstatus
case 1
;user chose Cancel
halt
endcase
case 10
;user chose OK
exitwhile
endcase
endswitch
endwhile
;Save the old MAILRUN.INI file if it exists
if isfile MailRunIni
OldIni = makefullname(TempDir, "oldini.tmp")
copyfile MailRunIni OldIni
MailRunBak = makefullname($WINPATH, "MAILRUN.BAK")
if isfile MailRunBak
delfile MailRunBak
endif
rename MailRunIni MailRunBak
endif
;Create the file MAILRUN.INI
fopen IniFile MailRunIni CREATE TEXT
if FAILURE
errormsg "Unable to create MAILRUN.INI;`r`nscript aborted...."
halt
endif
fputs IniFile "[MailRun]"
fputs IniFile "Version=2.10"
fputs IniFile "MailRun="
fputs IniFile "MailRunDir="
fputs IniFile "MailDir="
fputs IniFile "ReplyDir="
fputs IniFile "DownloadDir="
fputs IniFile "UploadDir="
fputs IniFile "DialAttempts="
fputs IniFile "DialTimeout="
fputs IniFile "DialPause="
fputs IniFile "IdleTimeout="
fputs IniFile "SavePackets="
fputs IniFile "LogRun="
fputs IniFile "AppendLog="
fputs IniFile "AnsiInLog="
fputs IniFile "NewfileFilter="
fputs IniFile "Archiver="
fputs IniFile "QWKReader="
fputs IniFile "LogViewer="
fputs IniFile "DLSortField=0"
fputs IniFile "ULSortField=0"
fputs IniFile "DLPurgeLimit=0"
fputs IniFile "ExecTime=HH:MM:SS"
fputs IniFile "AutoRun=0"
fputs IniFile "GoWait=1"
fputs IniFile "PostRun=1"
fputs IniFile "RingInterrupt=1"
fputs IniFile ""
fputs IniFile "[BBSTypes]"
fputs IniFile "BBSType_1=PCBoard 14.5"
fputs IniFile "BBSType_2=PCBoard 15.0"
fputs IniFile "BBSType_3=WildCat! 3.6"
fputs IniFile "BBSType_4=Auntie"
fputs IniFile "BBSType_5=RBBS"
fputs IniFile ""
fputs IniFile "[MailDoors]"
fputs IniFile "MailDoor_1=QMail"
fputs IniFile "MailDoor_2=MarkMail"
fputs IniFile "MailDoor_3=Cam-Mail"
fputs IniFile "MailDoor_4=RoseMail"
fputs IniFile "MailDoor_5=TomCat"
fputs IniFile "MailDoor_6=Auntie Mail"
fputs IniFile "MailDoor_7=KingMail"
fputs IniFile "MailDoor_8=Mail Manager"
fputs IniFile ""
fputs IniFile "[DEFAULT]"
fputs IniFile "BBSName="
fputs IniFile "BBSType=PCBoard 14.5"
fputs IniFile "MailDoorType=KingMail"
fputs IniFile "Number_1="
fputs IniFile "Number_2="
fputs IniFile "Number_3="
fputs IniFile "UserName="
fputs IniFile "PWord="
fputs IniFile "UserResp1="
fputs IniFile "UserResp2="
fputs IniFile "XferProt=ZModem"
fputs IniFile "MailXferProt=ZModem"
fputs IniFile "QWKArchiver=pkunzip.exe"
fputs IniFile "LangNumber="
fputs IniFile "GraphicsOn=1"
fputs IniFile "LangPrompt=Language"
fputs IniFile "GraphicsPrompt=graphics (Enter)"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "UserPrompt1="
fputs IniFile "UserPrompt2="
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=More?"
fputs IniFile "FilePrompt="
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Command?"
fputs IniFile "DLPrompt=Aborts Transfer"
fputs IniFile "DLUnavPrompt=(Enter)=none"
fputs IniFile "ULPrompt=Aborts Transfer"
fputs IniFile "ULDescPrompt=? ("
fputs IniFile "MsgMenuPrompt="
fputs IniFile "MailDoor=KM"
fputs IniFile "MailPrompt=KingMail Command"
fputs IniFile "ReceiveQWKPrompt=When Done"
fputs IniFile "MailDLPrompt=Aborts Transfer"
fputs IniFile "MailULPrompt=Aborts Transfer"
fputs IniFile ""
fputs IniFile "[PCBoard 14.5]"
fputs IniFile "GraphicsOn=1"
fputs IniFile "MailDoorType=KingMail"
fputs IniFile "LangPrompt=Language"
fputs IniFile "GraphicsPrompt=graphics (Enter)"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=More?"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Command?"
fputs IniFile "DLPrompt=Aborts Transfer"
fputs IniFile "DLUnavPrompt=(Enter)=none"
fputs IniFile "ULPrompt=Aborts Transfer"
fputs IniFile "ULDescPrompt=? ("
fputs IniFile ""
fputs IniFile "[PCBoard 15.0]"
fputs IniFile "GraphicsOn=1"
fputs IniFile "MailDoorType=KingMail"
fputs IniFile "UserResp1=n"
fputs IniFile "UserPrompt1=Personal Mail"
fputs IniFile "LangPrompt=Language"
fputs IniFile "GraphicsPrompt=graphics (Enter)"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=More?"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Command?"
fputs IniFile "DLPrompt=Aborts Transfer"
fputs IniFile "DLUnavPrompt=(Enter)=none"
fputs IniFile "ULPrompt=Aborts Transfer"
fputs IniFile "ULDescPrompt=? ("
fputs IniFile ""
fputs IniFile "[WildCat! 3.6]"
fputs IniFile "MailDoorType=TomCat"
fputs IniFile "CallingFrom=City"
fputs IniFile "UserResp1=Birth Date"
fputs IniFile "UserResp2=Telephone"
fputs IniFile "GraphicsOn=0"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "UserPrompt1=Birth Date"
fputs IniFile "UserPrompt2=phone"
fputs IniFile "ScanPrompt=Last Read"
fputs IniFile "ViewPrompt=View"
fputs IniFile "MorePrompt=[S]top"
fputs IniFile "FilePrompt=FILE MENU"
fputs IniFile "ContinuePrompt=ontinue"
fputs IniFile "CommandPrompt=MAIN MENU"
fputs IniFile "DLPrompt=Please begin"
fputs IniFile "DLUnavPrompt=file # 1"
fputs IniFile "ULPrompt=Please begin"
fputs IniFile "ULDescPrompt=Description?"
fputs IniFile ""
fputs IniFile "[Auntie]"
fputs IniFile "GraphicsOn=0"
fputs IniFile "UserResp1=^C"
fputs IniFile "UserResp2=3"
fputs IniFile "MailDoorType=Auntie Mail"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "UserPrompt1=select the one"
fputs IniFile "UserPrompt2=Choice (1, 2 or 3)"
fputs IniFile "ViewPrompt=Bulletin:"
fputs IniFile "FilePrompt=Files Area"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Main Area"
fputs IniFile "DLPrompt=Ctrl+X"
fputs IniFile "DLUnavPrompt=Enter date"
fputs IniFile "ULPrompt=Ctrl+X"
fputs IniFile "ULDescPrompt=1 ?"
fputs IniFile ""
fputs IniFile "[RBBS]"
fputs IniFile "GraphicsOn=0"
fputs IniFile "MailDoorType=Mail Manager"
fputs IniFile "NamePrompt=first name"
fputs IniFile "PWordPrompt=Password"
fputs IniFile "UserResp1=n"
fputs IniFile "UserPrompt1=Review new files"
fputs IniFile "ScanPrompt=Check"
fputs IniFile "ViewPrompt=new bulletins"
fputs IniFile "MorePrompt=More"
fputs IniFile "FilePrompt=FILE Command"
fputs IniFile "ContinuePrompt=Continue"
fputs IniFile "CommandPrompt=Main Command"
fputs IniFile "DLPrompt=for transfer"
fputs IniFile "DLUnavPrompt=[ENTER] quits"
fputs IniFile "ULPrompt=for transfer"
fputs IniFile "ULDescPrompt=+----+|"
fputs IniFile ""
fputs IniFile "[KingMail]"
fputs Inifile "MailDoor=KM"
fputs IniFile "MailPrompt=KingMail Command"
fputs IniFile "ReceiveQWKPrompt=When Done"
fputs IniFile "MailDLPrompt=Aborts Transfer"
fputs IniFile "MailULPrompt=Aborts Transfer"
fputs IniFile ""
fputs IniFile "[QMail]"
fputs IniFile "MailDoor=QM"
fputs IniFile "MailPrompt=QMail Command"
fputs IniFile "ReceiveQWKPrompt=these messages"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[MarkMail]"
fputs Inifile "MailDoor=MM"
fputs IniFile "MailPrompt=MarkMail Command"
fputs IniFile "ReceiveQWKPrompt=When Done"
fputs IniFile "MailDLPrompt=Aborts Transfer"
fputs IniFile "MailULPrompt=Aborts Transfer"
fputs IniFile ""
fputs IniFile "[RoseMail]"
fputs IniFile "MailDoor=RM"
fputs IniFile "MailPrompt=RoseMail Command"
fputs IniFile "ReceiveQWKPrompt=this Packet"
fputs IniFile "MailDLPrompt=Prepare to download"
fputs IniFile "MailULPrompt=Prepare to upload"
fputs IniFile ""
fputs IniFile "[Cam-Mail]"
fputs IniFile "MailDoor=CM"
fputs IniFile "MailPrompt=Cam-Mail Command"
fputs IniFile "ReceiveQWKPrompt=these messages"
fputs IniFile "MailDLPrompt=Prepare to upload"
fputs IniFile "MailULPrompt=Start your transfer"
fputs IniFile ""
fputs IniFile "[TomCat]"
fputs IniFile "MailDoor=T"
fputs IniFile "MsgMenuPrompt=MESSAGE MENU"
fputs IniFile "MailPrompt=TOMCAT MENU"
fputs IniFile "ReceiveQWKPrompt=when done"
fputs IniFile "MailDLPrompt=Start your"
fputs IniFile "MailULPrompt=Start your"
fputs IniFile ""
fputs IniFile "[Auntie Mail]"
fputs IniFile "MailDoor="
fputs IniFile "MailPrompt="
fputs IniFile "ReceiveQWKPrompt="
fputs IniFile "MailDLPrompt=Ctrl+X"
fputs IniFile "MailULPrompt=Ctrl+X"
fputs IniFile ""
fputs IniFile "[Mail Manager]"
fputs IniFile "MailDoor=d;mail"
fputs IniFile "MailPrompt=Your choice"
fputs IniFile "ReceiveQWKPrompt=this packet"
fputs IniFile "MailDLPrompt=Ready to send"
fputs IniFile "MailULPrompt=Ready to receive"
fclose IniFile
MailRun = MailRunIni
if isfile OldIni
;if there was a previous version of MailRun installed,
;read the default values from the old file.
;don't offer the Aspect directory as a default for MailRunDir
profilerd OldIni "MailRun" "MailRunDir" MailRunDir
temp = makefullname(MailRunDir, "*")
fetch aspect scriptpath AspectDir
addfilename AspectDir "*"
if strcmpi temp AspectDir
MailRunDir = makefullname($PWTASKPATH, "mailrun")
endif
profilerd OldIni "MailRun" "MailRun" MailRun
profilerd OldIni "MailRun" "DownloadDir" DownloadDir
profilerd OldIni "MailRun" "UploadDir" UploadDir
profilerd OldIni "MailRun" "MailDir" MailDir
profilerd OldIni "MailRun" "ReplyDir" ReplyDir
profilerd OldIni "MailRun" "DialAttempts" DialAttempts
profilerd OldIni "MailRun" "DialTimeout" DialTimeout
profilerd OldIni "MailRun" "DialPause" DialPause
profilerd OldIni "MailRun" "IdleTimeout" IdleTimeout
profilerd OldIni "MailRun" "SavePackets" SavePackets
profilerd OldIni "MailRun" "LogRun" LogRun
profilerd OldIni "MailRun" "AppendLog" AppendLog
profilerd OldIni "MailRun" "AnsiInLog" AnsiInLog
profilerd OldIni "MailRun" "NewfileFilter" NewfileFilter
profilerd OldIni "MailRun" "Archiver" Archiver
profilerd OldIni "MailRun" "QWKReader" QWKReader
profilerd OldIni "MailRun" "LogViewer" LogViewer
else
;otherwise, suggest default values based on current system settings
fetch dialdir maxdial StateMaxDial
fetch dialdir waitcnct StateWaitCnct
fetch dialdir callpause StateCallPause
fetch dnldpath StateDLPath
fetch upldpath StateULPath
MailRun = "mailrun.mrn"
MailRunDir = makefullname($PWTASKPATH, "mailrun")
DownloadDir = StateDLPath
UploadDir = StateULPath
MailDir = StateDLPath
ReplyDir = StateULPath
itoa StateMaxDial DialAttempts
itoa StateWaitCnct DialTimeout
itoa StateCallPause DialPause
IdleTimeout = "120"
SavePackets = "3"
LogRun = 1
AppendLog = 0
AnsiInLog = 0
NewfileFilter = 0
endif
if Version == 2.00
getbbstypes()
endif
MailRunList = "MAILRUN.INI"
MailRunTrunc = "MAILRUN.INI"
endproc
#comment
*********************************************************************
*
* GETBBSTYPES()
*
* Called by makeini()
*
* Adds any user created prompt sets from a previous version
* of MailRun to MAILRUN.INI.
*
*********************************************************************
#endcomment
proc getbbstypes
string BBSType_X, BBSType, MailDoor_X, MailDoorType, temp
integer i, j
i = 1
j = 6
strfmt BBSType_X "BBSType_%d" i
profilerd OldIni "BBSTypes" BBSType_X BBSType
while not NULLSTR BBSType
switch BBSType
case "PCBoard 14.5"
case "WildCat! 3.5"
case "WildCat! 3.6"
case "Auntie"
case "RBBS"
endcase
default
strfmt BBSType_X "BBSType_%d" j
j++
profilewr MailRunIni "BBSTypes" BBSType_X BBSType
profilerd OldIni BBSType "MailDoorType" temp
profilewr MailRunIni BBSType "MailDoorType" temp
profilerd OldIni BBSType "LangPrompt" temp
profilewr MailRunIni BBSType "LangPrompt" temp
profilerd OldIni BBSType "GraphicsPrompt" temp
profilewr MailRunIni BBSType "GraphicsPrompt" temp
profilerd OldIni BBSType "NamePrompt" temp
profilewr MailRunIni BBSType "NamePrompt" temp
profilerd OldIni BBSType "PWordPrompt" temp
profilewr MailRunIni BBSType "PWordPrompt" temp
profilerd OldIni BBSType "Confirm1Prompt" temp
profilewr MailRunIni BBSType "UserPrompt1" temp
profilerd OldIni BBSType "Confirm2Prompt" temp
profilewr MailRunIni BBSType "UserPrompt2" temp
profilerd OldIni BBSType "ViewPrompt" temp
profilewr MailRunIni BBSType "ViewPrompt" temp
profilerd OldIni BBSType "ScanPrompt" temp
profilewr MailRunIni BBSType "ScanPrompt" temp
profilerd OldIni BBSType "FilePrompt" temp
profilewr MailRunIni BBSType "FilePrompt" temp
profilerd OldIni BBSType "MorePrompt" temp
profilewr MailRunIni BBSType "MorePrompt" temp
profilerd OldIni BBSType "ContinuePrompt" temp
profilewr MailRunIni BBSType "ContinuePrompt" temp
profilerd OldIni BBSType "CommandPrompt" temp
profilewr MailRunIni BBSType "CommandPrompt" temp
profilerd OldIni BBSType "DLPrompt" temp
profilewr MailRunIni BBSType "DLPrompt" temp
profilerd OldIni BBSType "DLUnavPrompt" temp
profilewr MailRunIni BBSType "DLUnavPrompt" temp
profilerd OldIni BBSType "ULPrompt" temp
profilewr MailRunIni BBSType "ULPrompt" temp
profilerd OldIni BBSType "ULDescPrompt" temp
profilewr MailRunIni BBSType "ULDescPrompt" temp
endcase
endswitch
i++
strfmt BBSType_X "BBSType_%d" i
profilerd OldIni "BBSTypes" BBSType_X BBSType
endwhile
i = 1
j = 9
strfmt MailDoor_X "MailDoor_%d" i
profilerd OldIni "MailDoors" MailDoor_X MailDoorType
while not NULLSTR MailDoorType
switch MailDoorType
case "QMail"
case "MarkMail"
case "Cam-Mail"
case "RoseMail"
case "KingMail"
case "TomCat"
case "Auntie Mail"
case "Mail Manager"
endcase
default
strfmt MailDoor_X "MailDoor_%d" j
j++
profilewr MailRunIni "MailDoors" MailDoor_X MailDoorType
profilerd OldIni MailDoorType "MailDoor" temp
profilewr MailRunIni MailDoorType "MailDoor" temp
profilerd OldIni MailDoorType "MailPrompt" temp
profilewr MailRunIni MailDoorType "MailPrompt" temp
profilerd OldIni MailDoorType "ReceiveQWKPrompt" temp
profilewr MailRunIni MailDoorType "ReceiveQWKPrompt" temp
profilerd OldIni MailDoorType "MailDLPrompt" temp
profilewr MailRunIni MailDoorType "MailDLPrompt" temp
profilerd OldIni MailDoorType "MailULPrompt" temp
profilewr MailRunIni MailDoorType "MailULPrompt" temp
profilerd OldIni MailDoorType "MsgMenuPrompt" temp
profilewr MailRunIni MailDoorType "MsgMenuPrompt" temp
profilerd OldIni MailDoorType "QWKArchiver" temp
profilewr MailRunIni MailDoorType "QWKArchiver" temp
profilerd OldIni MailDoorType "MailXferProt" temp
profilewr MailRunIni MailDoorType "MailXferProt" temp
endcase
endswitch
i++
strfmt MailDoor_X "MailDoor_%d" i
profilerd OldIni "MailDoors" MailDoor_X MailDoorType
endwhile
endproc
#comment
*********************************************************************
*
* CHANGESETTINGS()
*
* Called by main()
*
* Calls checkdir(), settingsbox()
*
* Allows the user to change the defaults in MAILRUN.INI.
*
*********************************************************************
#endcomment
proc changesettings
string LastMRunDir, LastMailDir, LastReplyDir
string LastDLDir, LastULDir
string SaveMsg = "You have not saved your MailRun settings. \
Select `"OK`" to return, `"Cancel`" to abort MailRun."
integer dialogstatus, savestatus
integer Response
;Save old values in case of error in directory creation
LastMRunDir = MailRunDir
LastMailDir = MailDir
LastReplyDir = ReplyDir
LastDLDir = DownloadDir
LastULDir = UploadDir
settingsbox()
disable CTRL 170
savestatus = 1
while 1
dialogstatus = $DIALOG
switch dialogstatus
case 10
;User selected "Save"
;if the directories chosen in settingsbox()
;don't exist, create them
if checkdir(&MailRunDir, LastMRunDir) && \
checkdir(&MailDir, LastMailDir) && \
checkdir(&ReplyDir, LastReplyDir) && \
checkdir(&DownloadDir, LastDLDir) && \
checkdir(&UploadDir, LastULDir)
;if all directories exist or were successfully created
;write the settings to MAILRUN.INI
chdir MailRunDir
profilewr MailRunIni "MailRun" "MailRunDir" MailRunDir
profilewr MailRunIni "MailRun" "MailDir" MailDir
profilewr MailRunIni "MailRun" "ReplyDir" ReplyDir
profilewr MailRunIni "MailRun" "DownloadDir" DownloadDir
profilewr MailRunIni "MailRun" "UploadDir" UploadDir
profilewr MailRunIni "MailRun" "DialAttempts" DialAttempts
profilewr MailRunIni "MailRun" "DialTimeout" DialTimeout
profilewr MailRunIni "MailRun" "DialPause" DialPause
profilewr MailRunIni "MailRun" "IdleTimeout" IdleTimeout
profilewr MailRunIni "MailRun" "SavePackets" SavePackets
profilewr MailRunIni "MailRun" "LogRun" LogRun
profilewr MailRunIni "MailRun" "AppendLog" AppendLog
profilewr MailRunIni "MailRun" "AnsiInLog" AnsiInLog
profilewr MailRunIni "MailRun" "NewfileFilter" NewfileFilter
profilewr MailRunIni "MailRun" "Archiver" Archiver
profilewr MailRunIni "MailRun" "QWKReader" QWKReader
profilewr MailRunIni "MailRun" "LogViewer" LogViewer
else
updatedlg 128
loopwhile
endif
savestatus = 0
endcase
case 11
;User selected "Done"
if savestatus == 0
;if settings have been saved, return to processing
exitwhile
endif
if savestatus == 1
;if settings have not been saved, display a warning
sdlgmsgbox "MailRun Message" SaveMsg EXCLAMATION \
OKCANCEL Response 1
switch Response
case 1
;User selected "OK" to continue
loopwhile
endcase
case 2
;User selected "Cancel" to abort
delfile MailRunIni
halt
endcase
endswitch
endif
endcase
case 70
;User selected the "Capture mailrun..." checkbox
if LogRun == 0
disable CTRL 71
disable CTRL 72
else
enable CTRL 71
enable CTRL 72
endif
savestatus = 1
updatedlg 1
endcase
case 230
case 231
case 232
case 233
case 234
case 235
case 236
case 237
case 238
case 239
case 240
case 241
case 242
case 71
case 72
case 73
savestatus = 1
endcase
endswitch
endwhile
endproc
#comment
*********************************************************************
*
* CHECKDIR()
*
* Called by main(), changesettings()
*
* Creates a directory. Returns 1 if directory was successfully
* created or already existed; returns 0 if an error ocurred in
* creation.
*
*********************************************************************
#endcomment
func checkdir : integer
strparm NewDir, OldDir
chdir NewDir
if FAILURE
mkdir NewDir
if FAILURE
usermsg "Unable to create directory %s" NewDir
NewDir = OldDir
return 0
endif
endif
return 1
endfunc
#comment
*********************************************************************
*
* MOVEDIR()
*
* Called by main()
*
* Calls makefullname(), movefiles()
*
* Moves MailRun source files to the MailRun directory.
*
*********************************************************************
#endcomment
proc movedir
string aspectpath, temp1, temp2
temp1 = makefullname(MailRunDir,"*")
fetch aspect defaultpath aspectpath
temp2 = makefullname(aspectpath, "*")
if not strcmpi temp1 temp2
movefiles(aspectpath, MailRunDir, "MRUN210?.WA?")
movefiles(aspectpath, MailRunDir, "MRUN210.H")
movefiles(aspectpath, MailRunDir, "NEWFILES.WA?")
movefiles(aspectpath, MailRunDir, "TERMINAL.WA?")
movefiles(aspectpath, MailRunDir, "MRUNICON.DLL")
movefiles(aspectpath, MailRunDir, "MAILRUN.WRI")
statmsg ""
endif
endproc
#comment
*********************************************************************
*
* MOVEFILES()
*
* Called by movedir()
*
* Calls makefullname()
*
* Moves all files matching a filespec from their current
* location to a new directory.
*
*********************************************************************
#endcomment
proc movefiles
strparm OldDir, NewDir, Spec
string OldFile, NewFile, OldSpec
OldSpec = makefullname(OldDir, Spec)
findfirst OldSpec
while FOUND
if not strcmpi $FILENAME "MRUN210.WAS"
if not strcmpi $FILENAME "MRUN210.WAX"
statmsg "Moving %s" $FILENAME
OldFile = makefullname(OldDir, $FILENAME)
NewFile = makefullname(NewDir, $FILENAME)
copyfile OldFile NewFile
delfile OldFile
endif
endif
findnext
endwhile
endproc
#comment
*********************************************************************
*
* UPDATEMRN()
*
* Called by main()
*
* Calls makefullname(), checkfile()
*
* Updates existing *.MRN files to MailRun 2.1 format.
*
*********************************************************************
#endcomment
proc updatemrn
string filespec, mrnfile, BBSi, XferProt, BBS_X, BBSType
string MailDoor, MailPrompt
integer i
filespec = makefullname(MailRunDir, "*.MRN")
findfirst filespec
while FOUND
statmsg "Updating Mailrun %s" $FILENAME
mrnfile = makefullname(MailRunDir, $FILENAME)
profilewr mrnfile "MailRun" "DLPurgeLimit" 0
profilewr mrnfile "MailRun" "GoWait" 1
profilewr mrnfile "MailRun" "PostRun" 1
profilewr mrnfile "MailRun" "RingInterrupt" 1
i = 1
strfmt BBS_X "BBS_%d" i
profilerd mrnfile "MailRun" BBS_X BBSi
while not NULLSTR BBSi
profilerd mrnfile BBSi "BBSType" BBSType
if strcmpi BBSType "WildCat! 3.5"
profilewr mrnfile BBSi "BBSType" "WildCat! 3.6"
profilewr mrnfile BBSi "MsgMenuPrompt" "MESSAGE MENU"
endif
if checkfile(OldIni) && (Version != 2.00)
profilewr mrnfile BBSi "BBSType" "PCBoard 14.5"
profilewr mrnfile BBSi "ViewPrompt" "View"
profilerd mrnfile BBSi "XferProt" XferProt
profilewr mrnfile BBSi "MailXferProt" XferProt
profilerd mrnfile BBSi "MailDoor" MailDoor
strfmt MailDoor "door;%s" MailDoor
profilewr mrnfile BBSi "MailDoor" MailDoor
profilerd mrnfile BBSi "MailPrompt" MailPrompt
if strfind MailPrompt "QMail"
profilewr mrnfile BBSi "MailDoorType" "QMail"
elseif strfind MailPrompt "MarkMail"
profilewr mrnfile BBSi "MailDoorType" "MarkMail"
elseif strfind MailPrompt "Cam-Mail"
profilewr mrnfile BBSi "MailDoorType" "Cam-Mail"
elseif strfind MailPrompt "RoseMail"
profilewr mrnfile BBSi "MailDoorType" "RoseMail"
elseif strfind MailPrompt "KingMail"
profilewr mrnfile BBSi "MailDoorType" "KingMail"
endif
endif
i++
strfmt BBS_X "BBS_%d" i
profilerd mrnfile "MailRun" BBS_X BBSi
endwhile
findnext
endwhile
statmsg ""
endproc
#comment
*********************************************************************
*
* GETTEMPDIR()
*
* Called by main()
*
* Assigns the name of the MailRun temporary directory to
* TempDir.
*
*********************************************************************
#endcomment
proc gettempdir
string env
getenv "TEMP" env
if NULLSTR env
TempDir = $PWTASKPATH
else
TempDir = env
endif
addfilename TempDir "MRUNTEMP"
endproc
#comment
*********************************************************************
*
* CHECKFILE()
*
* Called by main()
*
* Checks for a file's existence. Returns 1 if the file is
* found, 0 if not found.
*
*********************************************************************
#endcomment
func checkfile : integer
strparm FileNom
if isfile FileNom
return 1
else
return 0
endif
endfunc
#comment
*********************************************************************
*
* MAKEFULLNAME()
*
* Called by various.
*
* Appends a filename to a directory name.
*
*********************************************************************
#endcomment
func makefullname : string
strparm Directory, FileNamen
string FullName
FullName = Directory
addfilename FullName FileNamen
return FullName
endfunc
#comment
*********************************************************************
*
* WELCOMEBOX()
*
* Called by makeini()
*
* Displays a dialog box to welcome first time users.
*
*********************************************************************
#endcomment
proc welcomebox
HelpPage = 1
dialogbox 80 57 198 125 15 "MailRun" HELPID HelpPage
text 10 11 178 8 center "Welcome to MailRun!"
text 21 26 156 63 center "Before you begin, you will need to \
configure some basic system settings. Default settings for MailRun \
are stored in the file MAILRUN.INI, which may be manually edited.`r`n`r`n\
Press F1 for Help."
pushbutton 49 95 40 14 "OK" normal
pushbutton 104 95 40 14 "Cancel" cancel
enddialog
endproc
#comment
*********************************************************************
*
* SETTINGSBOX()
*
* Called by changesettings()
*
* Displays the MailRun Settings dialog box.
*
*********************************************************************
#endcomment
proc settingsbox
HelpPage = 13
dialogbox 15 36 340 222 15 "MailRun Settings" HELPID HelpPage
groupbox 10 28 200 96 "Directories" shadow
text 16 42 71 8 right "MailRun Directory:"
text 16 58 71 8 right "Mail Directory:"
text 16 74 71 8 right "Reply Directory:"
text 16 90 71 8 right "Download Directory:"
text 16 106 71 8 right "Upload Directory:"
editbox 91 56 110 12 MailDir
editbox 91 72 110 12 ReplyDir
editbox 91 88 110 12 DownloadDir
editbox 91 104 110 12 UploadDir
groupbox 224 28 102 96 "Parameters" shadow
text 234 42 62 8 right "Dial Attempts:"
text 234 58 62 8 right "Dial Timeout:"
text 234 74 62 8 right "Dial Pause:"
text 234 90 62 8 right "Idle Timeout:"
text 234 106 62 8 right "Packets to Save:"
editbox 300 40 16 12 DialAttempts
editbox 300 56 16 12 DialTimeout
editbox 300 72 16 12 DialPause
editbox 300 88 16 12 IdleTimeOut
editbox 300 104 16 12 SavePackets
groupbox 10 132 124 59 "Logging" shadow
checkbox 18 144 112 12 "Capture mailrun to log file" LogRun
checkbox 18 158 112 12 "Append to existing log file" AppendLog
checkbox 18 172 112 12 "Capture ANSI codes in log file" AnsiInLog
checkbox 18 200 134 12 "Filter duplicates from d/l database" NewfileFilter
groupbox 144 132 184 59 "Utilities" shadow
text 145 146 65 8 right "Archive Utility:"
text 145 160 65 8 right "QWK Mail Reader:"
text 145 174 65 8 right "Log File Viewer:"
editbox 214 144 107 12 Archiver
editbox 214 158 107 12 QWKReader
editbox 214 172 107 12 LogViewer
pushbutton 191 200 40 14 "&Save" normal default
pushbutton 252 200 40 14 "&Done" normal
text 100 11 52 8 right "Settings for:"
combobox 156 9 72 42 MailRunList MailRunTrunc sort
editbox 91 40 110 12 MailRunDir
enddialog
endproc